FROM golang:latest AS builder
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -extldflags '-static'" -o server .

FROM alpine:3.18
COPY --from=builder /app/server /usr/local/bin/server
EXPOSE 9999
CMD ["server"]